// import './style.less'

import * as THREE from "three";
import { VRHall } from "./VRHall.js";

async function main() {
  //准备材质
  //基础材质
  const basicMaterial = new THREE.MeshBasicMaterial({
    transparent: true,
    opacity: 0.5,
    color: 0x793e3e,
    side: THREE.DoubleSide,
    // wireframe: true,
  });
  //高光材质
  const phongMaterial = new THREE.MeshPhongMaterial({
    color: 0x793e3e,
    side: THREE.DoubleSide,
    shininess: 30,
    // wireframe: true,
  });
  //哑光材质
  const shadowMaterial = new THREE.MeshLambertMaterial({
    color: 0x793e3e,
    side: THREE.DoubleSide,
    // wireframe: true,
  });
  //标准材质
  const standardMaterial = new THREE.MeshStandardMaterial({
    transparent: true,
    opacity: 0.5,
    color: 0x793e3e,
    // color: 0x000000,
    side: THREE.DoubleSide,
    metalness: 0.25, //金属度 0 非金属 1 金属
    roughness: 0, //粗糙度 0 无粗糙 1 粗糙
  });

  //物理材质
  const physicalMaterial = new THREE.MeshPhysicalMaterial({
    color: 0x793e3e,
    // color: 0x888888,
    side: THREE.DoubleSide,
    metalness: 0.25, //金属度 0 非金属 1 金属
    roughness: 0, //粗糙度 0 无粗糙 1 粗糙

    transmission: 0.9, //透射率 1 完全透明 0 完全不透明
  });

  //const texture = textureLoader.load('textures/hall.png');
  const bodyMaterial = new THREE.MeshPhysicalMaterial({
    side: THREE.DoubleSide,
    color: "red",
    metalness: 1, //金属度 0 非金属 1 金属
    roughness: 0.5, //粗糙度 0 光滑 1 粗糙

    clearcoat: 1, //外层层厚度 0 无外层层 1 最大外层层厚度
    clearcoatRoughness: 0.5, //外层层粗糙度 0 无外层层 1 最大外层层粗糙度
  }); //车身材质

  //玻璃材质
  const bodyGlassMaterial = new THREE.MeshStandardMaterial({
    color: 0x000000,
    metalness: 0.2, //金属度 0 非金属 1 金属
    roughness: 0.1, //粗糙度 0 无粗糙 1 粗糙
  }); //车身玻璃材质

  //地板材质
  const floorMaterial = new THREE.MeshStandardMaterial({
    color: 0x808080,
    side: THREE.DoubleSide,
    metalness: 0, //金属度 0 非金属 1 金属
    roughness: 0.1, //粗糙度 0 无粗糙 1 粗糙
  }); //地板材质

  const vrHall = new VRHall({
    container: document.getElementById("app"),
  });
  vrHall.init();
  // const hall= await vrHall.loadHall({
  //     url: './models/hall.glb',
  //     position:{
  //         x:0,
  //         y:0,
  //         z:0,
  //     },
  //     onProgress: (e) => {
  //         //console.log(e);
  //         console.log(`Loading progress: ${e.loaded / e.total * 100}%`);
  //     },
  // });
  // console.log(hall);

  //     //加载gltf模型
  //     const gltf = await vrHall.loadGltf({
  //         url: './models/hall.glb',
  //         onProgress: (e) => {
  //             console.log(`Loading gltf progress: ${e.loaded / e.total * 100}%`);
  //         },
  //     });
  //     const hall=gltf.scene
  //     const animations=gltf.animations;
  //     vrHall._scene.add(hall);
  //     console.log(gltf);

  //    const texture = await vrHall.loadTexture({
  //         url: './textures/hall.png'
  //     });
  //     console.log(texture);
  //     //设置材质贴图
  //     const material = new THREE.MeshBasicMaterial({
  //         map: texture,
  //     });
  //     hall.children[0].material = material;
  //     //console.log(hall.material.map);
  //     //console.log(animations);
  //     //vrHall.test1();
  //     //console.log(vrHall);
}
main();

console.log("Hello, World!");
